package com.jishuo.nontax.bfc.service;

import com.jishuo.base.bean.BaseResult;
import com.jishuo.base.util.GTimeUtil;
import com.jishuo.base.util.SpringContextUtil;
import com.jishuo.base.util.XmlUtils;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * 公共银行接口
 * @author wsjjiang
 *
 */
public class CommBankService {

    @Resource
    private BaseDataService baseDataService;

	//一般缴款书调用银行接口，参数后续定义
	public Map<String,String> processChargeBillPay()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		rtn.put("hx_paybankdt", GTimeUtil.getDateTimeMark());
		rtn.put("hx_bankaffirm", createBankAffirm("cz"));
		rtn.put("hx_paywaycode", "hx_paywaycode");
		rtn.put("bankstation", "bankstation");
		return rtn;
	}
	//一般缴款书手工票调用银行接口，参数后续定义
	public Map<String,String> processChargeBillHandPay()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		rtn.put("hx_paybankdt", GTimeUtil.getDateTimeMark());
		rtn.put("hx_bankaffirm", createBankAffirm("ch"));
		rtn.put("hx_paywaycode", "hx_paywaycode");
		rtn.put("bankstation", "bankstation");
		return rtn;
	}
	//一般缴款书调用银行接口，参数后续定义
	public Map<String,String> processReWaitAffirmPay()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		rtn.put("hx_paybankdt", GTimeUtil.getDateTimeMark());
		rtn.put("hx_bankaffirm", createBankAffirm("wc"));
		rtn.put("hx_paywaycode", "hx_paywaycode");
		rtn.put("bankstation", "bankstation");
		return rtn;
	}
	//一般缴款书手工票调用银行接口，参数后续定义
	public Map<String,String> processReWaitAffirmHandPay()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		rtn.put("hx_paybankdt", GTimeUtil.getDateTimeMark());
		rtn.put("hx_bankaffirm", createBankAffirm("wh"));
		rtn.put("hx_paywaycode", "hx_paywaycode");
		rtn.put("bankstation", "bankstation");
		return rtn;
	}
	//学校缴费调用银行接口，参数后续定义
	public Map<String,String> processStudentPay()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		rtn.put("hx_paybankdt", GTimeUtil.getDateTimeMark());
		rtn.put("hx_bankaffirm", createBankAffirm("st"));
		rtn.put("bankstation", "bankstation");
		return rtn;
	}
	//退付书用银行接口，参数后续定义
	public Map<String,String> processBackBillPay()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		rtn.put("hx_paybankdt", GTimeUtil.getDateTimeMark());
		rtn.put("hx_bankaffirm", createBankAffirm("bp"));
		rtn.put("bankstation", "bankstation");
		return rtn;
	}
	//划解分成调用银行接口，参数后续定义
	public Map<String,String> processPayDividePay()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		rtn.put("hx_paybankdt", GTimeUtil.getDateTimeMark());
		rtn.put("hx_bankaffirm", createBankAffirm("fc"));
		rtn.put("bankstation", "bankstation");
		return rtn;
	}
	//划解国库调用银行接口，参数后续定义
	public Map<String,String> processPayFiscPay()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		rtn.put("hx_paybankdt", GTimeUtil.getDateTimeMark());
		rtn.put("hx_bankaffirm", createBankAffirm("gk"));
		rtn.put("bankstation", "bankstation");
		return rtn;
	}
	//划解专户调用银行接口，参数后续定义
	public Map<String,String> processPaySpecialPay()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		rtn.put("hx_paybankdt", GTimeUtil.getDateTimeMark());
		rtn.put("hx_bankaffirm", createBankAffirm("zh"));
		rtn.put("bankstation", "bankstation");
		return rtn;
	}
	//划解专户调用银行接口，参数后续定义
	public Map<String,String> processIllegalactivityPay()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		//获取银行返回数据
		rtn.put("hx_paybankdt", GTimeUtil.getDateTimeMark());
		rtn.put("hx_bankaffirm", createBankAffirm("jj"));
		rtn.put("bankstation", "bankstation");
		return rtn;
	}
	//划解专户调用银行接口，参数后续定义
	public Map<String,String> processIllegalactivityDividePay()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		rtn.put("hx_paybankdt", GTimeUtil.getDateTimeMark());
		rtn.put("hx_bankaffirm", createBankAffirm("jp"));
		rtn.put("bankstation", "bankstation");
		return rtn;
	}
	//待查收入调用银行接口，参数后续定义
	public Map<String,String> processWaitAffirmPay()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		rtn.put("hx_paybankdt", GTimeUtil.getDateMark());
		rtn.put("hx_bankaffirm", createBankAffirm("wf"));
		rtn.put("bankstation", "bankstation");
		return rtn;
	}
	//电子缴费用银行接口，参数后续定义
	public Map<String,String> processEticketNum()
	{
		Map<String,String> rtn = new HashMap<String,String>();
		rtn.put("hx_paybankdt", GTimeUtil.getDateTimeMark());
		rtn.put("hx_bankaffirm", createBankAffirm("en"));
		rtn.put("bankstation", "bankstation");
		return rtn;
	}

	public BaseResult findPayWay()
	{
		BaseDataService baseDataService = (BaseDataService) SpringContextUtil.getBean("baseDataService");
		BaseResult result = baseDataService.findPayWay();
		BaseResult list = XmlUtils.xmltoList((String)result.getData());
		return list;
	}

	public String createBankAffirm(String type)
	{
		String bankaffirm = type + GTimeUtil.getFullDateTime();
		String snum = "000";
		int num = (int)(Math.random()*1000);
		if(num>=1000 || num<1) num = 1;
		snum = snum+num;
		snum = snum.substring(snum.length()-3);
		return bankaffirm+snum;
	}

}
